Skip to content

Override fleet.ssl.certificate_authorities from env vars in container mode#15427

Merged
lorienhu merged 8 commits into
mainfrom
lhu-issue-15408
Jul 11, 2026
Merged

Override fleet.ssl.certificate_authorities from env vars in container mode#15427
lorienhu merged 8 commits into
mainfrom
lhu-issue-15408

Conversation

@lorienhu

@lorienhu lorienhu commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

What does this PR do?

When in container mode, override fleet.ssl.certificate_authorities from env vars FLEET_CA, KIBANA_CA, and ELASTICSEARCH_CA instead of using saved fleet.enc values.

Follows the same first-set-wins fallback chain used in setup_config.go.

Why is it important?

Without this override, an agent running in container mode will crash during startup if fleet.enc still contains a fleet.ssl.certificate_authorities path that no longer exists on disk.

Checklist

  • I have read and understood the pull request guidelines of this project.
  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • [ ] I have made corresponding changes to the documentation
  • [ ] I have made corresponding change to the default configuration files
  • I have added tests that prove my fix is effective or that my feature works
  • I have added an entry in ./changelog/fragments using the changelog tool
  • I have added an integration test or an E2E test

Disruptive User Impact

N/A

How to test this PR locally

Unit test: TestContainerEnvOverridesFleetTLSPaths
Integration test: TestContainerCMDTLSCertOverride
Manually: Using kind, deploy ECK cluster. Enroll an agent with FLEET_SERVER_CLIENT_AUTH=required and FLEET_CA pointing to a mounted CA bundle. Unmount the CA bundle, unset env vars, and verify that agent restarts healthy.

Related issues

Closes #15408
Relates #14408

@mergify

This comment was marked as resolved.

@lorienhu lorienhu added bug Something isn't working backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches backport-8.19 Automated backport to the 8.19 branch labels Jul 8, 2026
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment was marked as resolved.

@lorienhu lorienhu marked this pull request as ready for review July 9, 2026 14:25
@lorienhu lorienhu requested a review from a team as a code owner July 9, 2026 14:25
@lorienhu lorienhu requested review from swiatekm and ycombinator July 9, 2026 14:25
Comment thread testing/integration/ess/container_cmd_test.go
@github-actions

This comment has been minimized.

Comment thread internal/pkg/agent/cmd/container_test.go Outdated
@infra-vault-gh-plugin-prod

Copy link
Copy Markdown

💛 Build succeeded, but was flaky

Failed CI Steps

History

cc @lorienhu

@lorienhu lorienhu requested review from swiatekm and ycombinator July 11, 2026 00:30
@mergify

mergify Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@lorienhu lorienhu merged commit 3ca03cf into main Jul 11, 2026
23 checks passed
@lorienhu lorienhu deleted the lhu-issue-15408 branch July 11, 2026 12:44
@github-actions

Copy link
Copy Markdown
Contributor

@Mergifyio backport 9.5 9.4 9.3

@mergify

mergify Bot commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-8.19 Automated backport to the 8.19 branch backport-active-9 Automated backport with mergify to all the active 9.[0-9]+ branches bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[k8s/container] shouldFleetEnroll crashes when FLEET_CA path is stale in fleet.enc after mTLS-to-non-mTLS transition

3 participants